package com.zhiguang.cms.entity;

import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @author zhuzg
 *
 */
public class Article implements Serializable  {
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -2186184620024482966L;
	
	// 文章的作者
	private User author;
	//文章属于哪一个栏目channel
	private Channel channel;
	
	private Category category;
	
	private String id	   ;//int	11	0	否	是	
	private String title	;//varchar	50	0	是	否	标题
	private String content	;//text	0	0	是	否	内容
	private String picture	;//varchar	200	0	是	否	标题图片
	private Integer channelId;//	int	11	0	是	否	外键，频道表主键id
	private Integer categoryId	;//int	11	0	是	否	外键，分类表主键Id
	private Integer userId	;//int	11	0	是	否	外键，用户表的主键id
	private int hits	;//int	11	0	是	否	点击次数
	private int hot	;//int	11	0	是	否	是否热门
	private int status	;//int	11	0	是	否	0,刚发布,1审核通过,-1 审核未通过
	private int deleted	;//int	11	0	是	否	1 表示删除，逻辑删除
	private Date created	;//datetime	0		是	否	发布时间
	private Date updated	;//datetime	0		是	否	最后更新时间
	public User getAuthor() {
		return author;
	}
	public void setAuthor(User author) {
		this.author = author;
	}
	public Channel getChannel() {
		return channel;
	}
	public void setChannel(Channel channel) {
		this.channel = channel;
	}
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getPicture() {
		return picture;
	}
	public void setPicture(String picture) {
		this.picture = picture;
	}
	public Integer getChannelId() {
		return channelId;
	}
	public void setChannelId(Integer channelId) {
		this.channelId = channelId;
	}
	public Integer getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public int getHits() {
		return hits;
	}
	public void setHits(int hits) {
		this.hits = hits;
	}
	public int getHot() {
		return hot;
	}
	public void setHot(int hot) {
		this.hot = hot;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public int getDeleted() {
		return deleted;
	}
	public void setDeleted(int deleted) {
		this.deleted = deleted;
	}
	public Date getCreated() {
		return created;
	}
	public void setCreated(Date created) {
		this.created = created;
	}
	public Date getUpdated() {
		return updated;
	}
	public void setUpdated(Date updated) {
		this.updated = updated;
	}
	@Override
	public String toString() {
		return "Article [author=" + author + ", channel=" + channel + ", category=" + category + ", id=" + id
				+ ", title=" + title + ", content=" + content + ", picture=" + picture + ", channelId=" + channelId
				+ ", categoryId=" + categoryId + ", userId=" + userId + ", hits=" + hits + ", hot=" + hot + ", status="
				+ status + ", deleted=" + deleted + ", created=" + created + ", updated=" + updated + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((categoryId == null) ? 0 : categoryId.hashCode());
		result = prime * result + ((channelId == null) ? 0 : channelId.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Article other = (Article) obj;
		if (categoryId == null) {
			if (other.categoryId != null)
				return false;
		} else if (!categoryId.equals(other.categoryId))
			return false;
		if (channelId == null) {
			if (other.channelId != null)
				return false;
		} else if (!channelId.equals(other.channelId))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}	
	
	
	

}
